package com.wangp.safeCommit.controller;


import com.wangp.safeCommit.dto.HazardDateQueryRequestDTO;
import com.wangp.safeCommit.dto.HazardDateQueryResponseDTO;
import com.wangp.safeCommit.service.IHazardDataService;
import com.wangp.safeCommit.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 危险源数据 前端控制器
 * </p>
 *
 * @author zhangliang
 * @since 2024-12-17
 */
@RestController
@RequestMapping("/safeCommit/hazardDataEntity")
@CrossOrigin
public class HazardDataController {

    @Autowired
    private IHazardDataService hazardDataService;

 //   public static final String TOKEN_VALUE = "664312-ykdss-3f32e4d9e21743d1b22895048f";

    /**
     * 危险源数据 查询列表分页
     * @param hazardDTO
     * @return
     */
    @PostMapping("/dss/api/hazard/getHazardList")
    public Result<HazardDateQueryResponseDTO> getHazardList(@RequestBody HazardDateQueryRequestDTO hazardDTO, HttpServletRequest request) {


//        String value = request.getHeader("x-dss-token");
//        if (!TOKEN_VALUE.equals(value)){
//            return Result.authenticationFailed();
//        }

        return Result.success(hazardDataService.queryPage(hazardDTO));

    }
}

